package com.tsj.SpringBoot.vo;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.tsj.SpringBoot.service.TestImple;
import com.tsj.SpringBoot.service.TestService;

public class User {
	private static final Logger logger = LoggerFactory.getLogger(User.class);
	public Long id;
	public String name;
	
	@Test
	public void test() {
		
		    logger.trace("trace 级别的日志");
	        logger.debug("debug 级别的日志");
	        logger.info("info 级别的日志");
	        logger.warn("warn 级别的日志");
	        logger.error("error 级别的日志");
	     
	
	}
	@Test
	public void testDate() {	
		 GregorianCalendar c = new GregorianCalendar();
		c.setGregorianChange(new Date());
		logger.info(c.get(GregorianCalendar.YEAR)+"年");
		logger.info(c.get(GregorianCalendar.MONTH)+1+"月");
		logger.info(c.get(GregorianCalendar.DATE)+"日");
		logger.info(c.get(GregorianCalendar.HOUR_OF_DAY)+"时");
		logger.info(c.get(GregorianCalendar.MINUTE)+"分");
		logger.info(c.get(GregorianCalendar.SECOND)+"秒");
		logger.info(c.get(GregorianCalendar.MILLISECOND)+"毫秒");
		c.setGregorianChange(new Date(1589436890000l));
		int day = c.get(GregorianCalendar.DATE);
		System.out.println(day);
		Calendar ca = Calendar.getInstance();
		ca.set(Calendar.DATE, 0);
		logger.info("天："+ca.get(Calendar.DATE));
		logger.info("月："+(ca.get(Calendar.MONTH)+1));
		
	}
	
	@Test
	public void parmsTest() {
		User user = new User();
		user.parms(1,2,3,4,"s");
		
	}
	
	public void parms(Object... integers ) {
		
		for (Object integer : integers) {
			System.out.println(integer);
		}
		
	}
	
	public static void main(String[] args) throws IOException {
//		char c;
//        // 使用 System.in 创建 BufferedReader
//        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        System.out.println("输入字符, 按下 'q' 键退出。");
//        // 读取字符
//        do {
//            c = (char) br.read();
//            System.out.println(c);
//        } while (c != 'q');
		
//		 File f = new File("a.txt");
//	        FileOutputStream fop = new FileOutputStream(f);
//	        // 构建FileOutputStream对象,文件不存在会自动新建
//	 
//	        OutputStreamWriter writer = new OutputStreamWriter(fop, "UTF-8");
//	        // 构建OutputStreamWriter对象,参数可以指定编码,默认为操作系统默认编码,windows上是gbk
//	 
//	        writer.append("中文输入");
//	        // 写入到缓冲区
//	 
//	        writer.append("\r\n");
//	        // 换行
//	 
//	        writer.append("English");
//	        // 刷新缓存冲,写入到文件,如果下面已经没有写入的内容了,直接close也会写入
//	 
//	        writer.close();
//	        // 关闭写入流,同时会把缓冲区内容写入文件,所以上面的注释掉
//	 
//	        fop.close();
//	        // 关闭输出流,释放系统资源
//	 
//	        FileInputStream fip = new FileInputStream(f);
//	        // 构建FileInputStream对象
//	 
//	        InputStreamReader reader = new InputStreamReader(fip, "UTF-8");
//	        // 构建InputStreamReader对象,编码与写入相同
//	 
//	        StringBuffer sb = new StringBuffer();
//	        while (reader.ready()) {
//	            sb.append((char) reader.read());
//	            // 转成char加到StringBuffer对象中
//	        }
//	        System.out.println(sb.toString());
//	        reader.close();
//	        // 关闭读取流
//	 
//	        fip.close();
	        // 关闭输入流,释放系统资源
		
//		try {
//			System.out.println("try...");
//			return;
//		} finally {
//			System.out.println("finally...");
//		}
	 
		TestService t = new TestImple();
		t.test();
	    }
	
}
